<template>
	<div>
		<zbTable ref="tableRef" :api-fun="get_stock_query_list" @action="action">
			<!-- <template #toolbar>
				<a-space>
					<a-button :type="item.types == 'add' ? 'primary' : 'dashed'" v-for="item in optBtn" :key="item.url" v-permission="item.url" @click="topAction(item)">
						<template #icon>
							<plus-outlined v-if="item.types == 'add'" />
							<clear-outlined v-else-if="item.types == 'delete'" />
						</template>
						<span>{{ item.name }}</span>
					</a-button>
				</a-space>
			</template> -->
		</zbTable>
		<detail v-if="showDetail && goods_code" v-model:visible="showDetail" :goods_code="goods_code" :goods_category_code="goods_category_code" />
	</div>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { message, Modal } from 'ant-design-vue';
import { actionFn } from '@/utils/action.js';
import { daochuFn } from '@/utils/daochu.js';
import { PlusOutlined, UploadOutlined, ClearOutlined } from '@ant-design/icons-vue';
/* import zbTable from '@/components/zbTable/index.vue'; */
import zbTable from '@/components/zbTable/purchasePurchaseIndex.vue';
import detail from './components/detail.vue';
import { get_stock_query_list } from '@/api/warehouse/stock_query';
// 获取子组件
const tableRef = ref(null);
const optBtn = ref([]);
const showDetail = ref(false);
const goods_code = ref(null);
const goods_category_code = ref(null);
/* onMounted(() => {
	get_stock_query_list({ page: 1, page_size: 10 })
		.then(async res => {
			optBtn.value = res.top_button;
		})
		.catch(e => {
			message.error(e);
		});
});
const topAction = item => {
	if (item.types == 'export') {
		daochu();
	}
}; */
/* 打开编辑弹窗 */
const action = data => {
	console.log('data.action_data.type', data);
	if(data.action_data.type=='detail'){
		goods_code.value = data.row_data.code;
		goods_category_code.value = data.row_data.goods_category_code;
		showDetail.value = true;
	}
};

const done = form => {
	//console.log("actionData.value",actionData.value)
	//actionFn(actionData.value, form, reloadTable);
};
const daochu = () => {
	let data = {
		url: '/warehouse/stock_query/export',
		params: {},
		filename: '其它门店库存查询列表'
	};
	daochuFn(data);
};
</script>
